home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / program / ros_v1_2.lha / include / player / player610.2_ROS.s < prev    next >
Text File  |  1996-01-08  |  39KB  |  2,553 lines

  1. * The Player 6.1A for Asm-One 1.09 and later *
  2. * modified for use with ros.library by TIK/RETIRE
  3.  
  4. **
  5. **    $VER: player610.2_ROS.s 1.2 (08.01.96)
  6. **    Includes Release 1.2
  7. **
  8.  
  9. ********************************
  10. * do not change system flag!!! *
  11. ********************************
  12.  
  13. system = 1    ;0 = killer
  14.         ;1 = friendly
  15.  
  16. exec = 1    ;0 = ExecBase destroyed
  17.         ;1 = ExecBase valid
  18.  
  19. lev6 = 1    ;0 = NonLev6
  20.         ;1 = Lev6 used
  21.  
  22.  
  23.     include player/Player61.i
  24.  
  25. *-----------------------------------------------*
  26.  
  27.     printt    ""
  28.     printt    "P61A options used:"
  29.     printt    "------------------"
  30.     ifd    start
  31.     printt    "Starting from position"
  32.     printv    start
  33.     endc
  34.     ifne    fade
  35.     printt    "Mastervolume on"
  36.     else
  37.     printt    "Mastervolume off"
  38.     endc
  39.     ifne    system
  40.     printt    "System friendly"
  41.     else
  42.     printt    "System killer"
  43.     endc
  44.     ifne    CIA
  45.     printt    "CIA-tempo on"
  46.     else
  47.     printt    "CIA-tempo off"
  48.     endc
  49.     ifne    exec
  50.     printt    "ExecBase valid"
  51.     else
  52.     printt    "ExecBase invalid"
  53.     endc
  54.     ifne    lev6
  55.     printt    "Level 6 IRQ on"
  56.     else
  57.     printt    "Non-lev6 NOT IMPLEMENTED!"
  58.     if2
  59.     fail
  60.     endc
  61.     endc
  62.     ifne    opt020
  63.     printt    "MC68020 optimizations"
  64.     else
  65.     printt    "Normal MC68000 code"
  66.     endc
  67.     printt    "Channels:"
  68.     printv    channels
  69.     ifgt    channels-4
  70.     printt    "NO MORE THAN 4 CHANNELS!"
  71.     if2
  72.     fail
  73.     endc
  74.     endc
  75.     ifeq    channels
  76.     printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  77.     if2
  78.     fail
  79.     endc
  80.     endc
  81.     printt    "UseCode:"
  82.     printv    use
  83.  
  84. *-----------------------------------------------*
  85.  
  86. *********************************
  87. *        Player 6.1A ®        *
  88. *      All in one-version    *
  89. *        Version 610.2        *
  90. *   © 1992-95 Jarno Paananen    *
  91. *     All rights reserved    *
  92. *********************************
  93.  
  94.  
  95. ******** START OF BINARY FILE **************
  96.  
  97. P61_motuuli
  98.     bra.w    P61_Init
  99.     ifeq    CIA
  100.     bra.w    P61_Music
  101.     else
  102.     rts
  103.     rts
  104.     endc
  105.     bra.w    P61_End
  106.     rts                ;no P61_SetRepeat
  107.     rts
  108.     bra.w    P61_SetPosition
  109.  
  110. P61_Master    dc    64        ;Master volume (0-64)
  111. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  112. P61_Play    dc    1        ;Stop flag (0=stop)
  113. P61_E8        dc    0        ;Info nybble after command E8
  114. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  115.                     ;put VBR here! (Otherwise 0 assumed)
  116.                     ;You can also get VBR from here, if
  117.                     ;using exec-valid version
  118.  
  119. P61_Pos        dc    0        ;Current song position
  120. P61_Patt    dc    0        ;Current pattern
  121. P61_CRow    dc    0        ;Current pattern row
  122.  
  123. P61_Temp0Offset
  124.     dc.l    P61_temp0-P61_motuuli
  125. P61_Temp1Offset
  126.     dc.l    P61_temp1-P61_motuuli
  127. P61_Temp2Offset
  128.     dc.l    P61_temp2-P61_motuuli
  129. P61_Temp3Offset
  130.     dc.l    P61_temp3-P61_motuuli
  131.  
  132. P61_getnote    macro
  133.     moveq    #$7e,d0
  134.     and.b    (a5),d0
  135.     beq.b    .nonote
  136.     ifne    P61_vib
  137.     clr.b    P61_VibPos(a5)
  138.     endc
  139.     ifne    P61_tre
  140.     clr.b    P61_TrePos(a5)
  141.     endc
  142.  
  143.     ifne    P61_ft
  144.     add    P61_Fine(a5),d0
  145.     endc
  146.     move    d0,P61_Note(a5)
  147.     move    (a2,d0),P61_Period(a5)
  148.  
  149. .nonote
  150.     endm
  151.  
  152.     ifeq    system
  153.     ifne    CIA
  154. P61_intti
  155.     movem.l    d0-a6,-(sp)
  156.     tst.b    $bfdd00
  157.     lea    $dff000,a6
  158.     move    #$2000,$9c(a6)
  159.     move    #$fff,$180(a6)
  160.     bsr    P61_Music
  161.     move    #0,$180(a6)
  162.     movem.l    (sp)+,d0-a6
  163.     nop
  164.     rte
  165.     endc
  166.     endc
  167.  
  168. * modified for use with ROS.lib
  169.     ifne    system
  170. P61_lev6server
  171. ;    movem.l    d2-d7/a2-a6,-(sp)
  172. ;    lea    P61_timeron(pc),a0
  173. ;    tst    (a0)
  174. ;    beq.b    P61_ohi
  175. ;
  176. ;    lea    $dff000,a6
  177.     move.l    a5,a6
  178.     move    P61_server(pc),d0
  179.     beq.b    P61_musica
  180.     subq    #1,d0
  181.     beq    P61_dmason
  182.     bra    P61_setrepeat
  183.  
  184. P61_musica
  185.     bsr    P61_Music
  186.  
  187. P61_ohi
  188. ;    movem.l    (sp)+,d2-d7/a2-a6
  189. ;    moveq    #1,d0
  190.     rts
  191. ;    endc
  192.  
  193.  
  194. ; parameters modified for ROS usage
  195. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  196. ;­ Call P61_Init to initialize the playroutine    ­
  197. ;­ D0 --> Timer detection (for CIA-version)    ­
  198. ;­ D1 --> Which timer? 0=TimA, 1=TimB        ­
  199. ;­ A0 --> Address to the module            ­
  200. ;­ A1 --> Address to samples/0 if in the module    ­
  201. ;­ A2 --> Address to sample buffer        ­
  202. ;­         Uses d0/d1/a0/a1        ­
  203. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  204.  
  205. P61_Init
  206.     movem.l    d2-d7/a2-a6,-(sp)
  207.  
  208.     cmp.l    #"P61A",(a0)+
  209.     beq.b    .modok
  210.     subq.l    #4,a0
  211.  
  212. .modok    basereg    P61_cn,a3
  213.  
  214.     move.w    d1,-(sp)        ; timer a/b, modified for ROS usage
  215.     ifne    CIA
  216.     move    d0,-(sp)
  217.     endc
  218.  
  219.     moveq    #0,d0
  220.     cmp.l    d0,a1
  221.     bne.b    .redirect
  222.  
  223.     move    (a0),d0
  224.     lea    (a0,d0.l),a1
  225. .redirect
  226.     move.l    a2,a6
  227.     lea    8(a0),a2
  228.     moveq    #$40,d0
  229.     and.b    3(a0),d0
  230.     bne.b    .buffer
  231.     move.l    a1,a6
  232.     subq.l    #4,a2
  233. .buffer
  234.  
  235.     lea    P61_cn(pc),a3
  236.     moveq    #$1f,d1
  237.     and.b    3(a0),d1
  238.     move.l    a0,-(sp)
  239.     lea    P61_samples(pc),a4
  240.     subq    #1,d1
  241.     moveq    #0,d4
  242. P61_lopos
  243.     move.l    a6,(a4)+
  244.     move    (a2)+,d4
  245.     bpl.b    P61_kook
  246.     neg    d4
  247.     lea    P61_samples-16(pc),a5
  248.     ifeq    opt020
  249.     asl    #4,d4
  250.     move.l    (a5,d4),d6
  251.     else
  252.     add    d4,d4
  253.     move.l    (a5,d4*8),d6
  254.     endc
  255.     move.l    d6,-4(a4)
  256.     move    4(a5,d4),d4
  257.     sub.l    d4,a6
  258.     sub.l    d4,a6
  259.     bra.b    P61_jatk
  260.  
  261. P61_kook
  262.     move.l    a6,d6
  263.     tst.b    3(a0)
  264.     bpl.b    P61_jatk
  265.  
  266.     tst.b    (a2)
  267.     bmi.b    P61_jatk
  268.  
  269.     move    d4,d0
  270.     subq    #2,d0
  271.     bmi.b    P61_jatk
  272.  
  273.     move.l    a1,a5
  274.     move.b    (a5)+,d2
  275.     sub.b    (a5),d2
  276.     move.b    d2,(a5)+
  277. .loop    sub.b    (a5),d2
  278.     move.b    d2,(a5)+
  279.     sub.b    (a5),d2
  280.     move.b    d2,(a5)+
  281.     dbf    d0,.loop
  282.  
  283. P61_jatk
  284.     move    d4,(a4)+
  285.     moveq    #0,d2
  286.     move.b    (a2)+,d2
  287.     moveq    #0,d3
  288.     move.b    (a2)+,d3
  289.  
  290.     moveq    #0,d0
  291.     move    (a2)+,d0
  292.     bmi.b    .norepeat
  293.  
  294.     move    d4,d5
  295.     sub    d0,d5
  296.     move.l    d6,a5
  297.  
  298.     add.l    d0,a5
  299.     add.l    d0,a5
  300.  
  301.     move.l    a5,(a4)+
  302.     move    d5,(a4)+
  303.     bra.b    P61_gene
  304. .norepeat
  305.     move.l    d6,(a4)+
  306.     move    #1,(a4)+
  307. P61_gene
  308.     move    d3,(a4)+
  309.     moveq    #$f,d0
  310.     and    d2,d0
  311.     mulu    #74,d0
  312.     move    d0,(a4)+
  313.  
  314.     tst    -6(a2)
  315.     bmi.b    .nobuffer
  316.  
  317.     moveq    #$40,d0
  318.     and.b    3(a0),d0
  319.     beq.b    .nobuffer
  320.  
  321.     move    d4,d7
  322.     tst.b    d2
  323.     bpl.b    .copy
  324.  
  325.     subq    #1,d7
  326.     moveq    #0,d5
  327.     moveq    #0,d4
  328. .lo    move.b    (a1)+,d4
  329.     moveq    #$f,d3
  330.     and    d4,d3
  331.     lsr    #4,d4
  332.  
  333.     sub.b    .table(pc,d4),d5
  334.     move.b    d5,(a6)+
  335.     sub.b    .table(pc,d3),d5
  336.     move.b    d5,(a6)+
  337.     dbf    d7,.lo
  338.     bra.b    .kop
  339.  
  340. .copy    add    d7,d7
  341.     subq    #1,d7
  342. .cob    move.b    (a1)+,(a6)+
  343.     dbf    d7,.cob
  344.     bra.b    .kop
  345.  
  346. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  347.  
  348. .nobuffer
  349.     move.l    d4,d6
  350.     add.l    d6,d6
  351.     add.l    d6,a6
  352.     add.l    d6,a1
  353. .kop    dbf    d1,P61_lopos
  354.  
  355.     move.l    (sp)+,a0
  356.     and.b    #$7f,3(a0)
  357.  
  358.     move.l    a2,-(sp)
  359.  
  360.     lea    P61_temp0(pc),a1
  361.     lea    P61_temp1(pc),a2
  362.     lea    P61_temp2(pc),a4
  363.     lea    P61_temp3(pc),a5
  364.     moveq    #Channel_Block_SIZE/2-2,d0
  365.  
  366.     moveq    #0,d1
  367. .cl    move    d1,(a1)+
  368.     move    d1,(a2)+
  369.     move    d1,(a4)+
  370.     move    d1,(a5)+
  371.     dbf    d0,.cl
  372.  
  373.     lea    P61_temp0(a3),a1
  374.     lea    P61_emptysample(a3),a2
  375.     moveq    #channels-1,d0
  376. .l    move.l    a2,P61_Sample(a1)
  377.     add.w    #Channel_Block_SIZE,a1
  378.     dbf    d0,.l
  379.  
  380.     move.l    (sp)+,a2
  381.     move.l    a2,P61_positionbase(a3)
  382.  
  383.     moveq    #$7f,d1
  384.     and.b    2(a0),d1
  385.  
  386.     ifeq    opt020
  387.     lsl    #3,d1
  388.     lea    (a2,d1.l),a4
  389.     else
  390.     lea    (a2,d1.l*8),a4
  391.     endc
  392.     move.l    a4,P61_possibase(a3)
  393.  
  394.     move.l    a4,a1
  395.     moveq    #-1,d0
  396. .search    cmp.b    (a1)+,d0
  397.     bne.b    .search
  398.     move.l    a1,P61_patternbase(a3)    
  399.     move.l    a1,d0
  400.     sub.l    a4,d0
  401.     move    d0,P61_slen(a3)
  402.  
  403.     ifd    start
  404.     lea    start(a4),a4
  405.     endc
  406.  
  407.     moveq    #0,d0
  408.     move.b    (a4)+,d0
  409.     move.l    a4,P61_spos(a3)
  410.     lsl    #3,d0
  411.     add.l    d0,a2
  412.  
  413.     move.l    a1,a4
  414.     moveq    #0,d0    
  415.     move    (a2)+,d0
  416.     lea    (a4,d0.l),a1
  417.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  418.     move    (a2)+,d0
  419.     lea    (a4,d0.l),a1
  420.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  421.     move    (a2)+,d0
  422.     lea    (a4,d0.l),a1
  423.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  424.     move    (a2)+,d0
  425.     lea    (a4,d0.l),a1
  426.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  427.  
  428.     lea    P61_setrepeat(pc),a0
  429.     move.l    a0,P61_intaddr(a3)
  430.  
  431.     move    #63,P61_rowpos(a3)
  432.     move    #6,P61_speed(a3)
  433.     move    #5,P61_speed2(a3)
  434.     clr    P61_speedis1(a3)
  435.  
  436.     ifne    P61_pl
  437.     clr.l    P61_plcount(a3)
  438.     endc
  439.  
  440.     ifne    P61_pde
  441.     clr    P61_pdelay(a3)
  442.     clr    P61_pdflag(a3)
  443.     endc
  444.     clr    (a3)
  445.  
  446.     moveq    #2,d0
  447.     and.b    $bfe001,d0
  448.     move.b    d0,P61_ofilter(a3)
  449.     bset    #1,$bfe001
  450.  
  451.     ifeq    system
  452.     ifne    exec
  453.     move.l    4.w,a6
  454.     moveq    #0,d0
  455.     btst    d0,297(a6)
  456.     beq.b    .no68010
  457.  
  458.     lea    P61_liko(pc),a5
  459.     jsr    -$1e(a6)
  460.  
  461. .no68010
  462.     move.l    d0,P61_VBR(a3)
  463.     endc
  464.  
  465.     move.l    P61_VBR(a3),a0
  466.     lea    $78(a0),a0
  467.     move.l    a0,P61_vektori(a3)
  468.  
  469.     move.l    (a0),P61_oldlev6(a3)
  470.     lea    P61_dmason(pc),a1
  471.     move.l    a1,(a0)
  472.     endc
  473.  
  474.     moveq    #0,d0
  475.     lea    $dff000,a6
  476.     move    d0,$a8(a6)
  477.     move    d0,$b8(a6)
  478.     move    d0,$c8(a6)
  479.     move    d0,$d8(a6)
  480.     move    #$f,$96(a6)
  481.  
  482.     ifeq    system
  483.     lea    P61_dmason(pc),a1
  484.     move.l    a1,(a0)
  485.     move    #$2000,$9a(a6)
  486.     lea    $bfd000,a0
  487.     lea    P61_timers(pc),a1
  488.     move.b    #$7f,$d00(a0)
  489.     move.b    #$10,$e00(a0)
  490.     move.b    #$10,$f00(a0)
  491.     move.b    $400(a0),(a1)+
  492.     move.b    $500(a0),(a1)+
  493.     move.b    $600(a0),(a1)+
  494.     move.b    $700(a0),(a1)
  495.     endc
  496.  
  497.     ifeq    system!CIA
  498.     move.b    #$82,$d00(a0)
  499.     endc
  500.  
  501.     ifne    CIA
  502.     move    (sp)+,d0
  503.     subq    #1,d0
  504.     beq.b    P61_ForcePAL
  505.     subq    #1,d0
  506.     beq.b    P61_NTSC
  507.     ifne    exec
  508.     move.l    4.w,a1
  509.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  510.     beq.b    P61_NTSC
  511.     endc
  512. P61_ForcePAL
  513.     move.l    #1773447,d0    ;PAL
  514.     bra.b    P61_setcia
  515. P61_NTSC
  516.     move.l    #1789773,d0    ;NTSC
  517. P61_setcia
  518.     move.l    d0,P61_timer(a3)
  519.     divu    #125,d0
  520.     move    d0,P61_thi2(a3)
  521.     sub    #$1f0*2,d0
  522.     move    d0,P61_thi(a3)
  523.  
  524.     ifeq    system
  525.     move    P61_thi2(a3),d0
  526.     move.b    d0,$400(a0)
  527.     lsr    #8,d0
  528.     move.b    d0,$500(a0)
  529.     lea    P61_intti(pc),a1
  530.     move.l    a1,P61_tintti(a3)
  531.     move.l    P61_vektori(pc),a2
  532.     move.l    a1,(a2)
  533.     move.b    #$83,$d00(a0)
  534.     move.b    #$11,$e00(a0)
  535.     endc
  536.     endc
  537.  
  538.     ifeq    system
  539.     move    #$e000,$9a(a6)
  540.     moveq    #0,d0
  541.     rts
  542.  
  543.     ifne    exec
  544. P61_liko
  545.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  546.     rte
  547.     endc
  548.     endc
  549.  
  550.     ifne    system
  551. ;    move.l    a6,-(sp)
  552.  
  553.     ifne    CIA
  554.     clr    P61_server(a3)
  555.     else
  556.     move    #1,P61_server(a3)
  557.     endc
  558.  
  559.  
  560. * modified for use with ROS.lib
  561. ;    move.l    4.w,a6
  562. ;    moveq    #-1,d0
  563. ;    jsr    -$14a(a6)
  564. ;    move.b    d0,P61_sigbit(a3)
  565. ;    bmi    P61_err
  566. ;
  567. ;    lea    P61_allocport(pc),a1
  568. ;    move.l    a1,P61_portti(a3)
  569. ;    move.b    d0,15(a1)
  570. ;    move.l    a1,-(sp)
  571. ;    suba.l    a1,a1
  572. ;    jsr    -$126(a6)
  573. ;    move.l    (sp)+,a1
  574. ;    move.l    d0,16(a1)
  575. ;    lea    P61_reqlist(pc),a0
  576. ;    move.l    a0,(a0)
  577. ;    addq.l    #4,(a0)
  578. ;    clr.l    4(a0)
  579. ;    move.l    a0,8(a0)
  580. ;
  581. ;    lea    P61_dat(pc),a1
  582. ;    move.l    a1,P61_reqdata(a3)
  583. ;    lea    P61_allocreq(pc),a1
  584. ;    lea    P61_audiodev(pc),a0
  585. ;    moveq    #0,d0
  586. ;    moveq    #0,d1
  587. ;    jsr    -$1bc(a6)
  588. ;    tst.l    d0
  589. ;    bne    P61_err
  590. ;    st.b    P61_audioopen(a3)
  591. ;
  592. ;    lea    P61_timerint(pc),a1
  593. ;    move.l    a1,P61_timerdata(a3)
  594. ;    lea    P61_lev6server(pc),a1
  595. ;    move.l    a1,P61_timerdata+8(a3)
  596. ;
  597. ;    moveq    #0,d3
  598. ;    lea    P61_cianame(pc),a1
  599. ;P61_openciares
  600. ;    moveq    #0,d0
  601. ;    move.l    4.w,a6
  602. ;    jsr    -$1f2(a6)
  603. ;    move.l    d0,P61_ciares(a3)
  604. ;    beq.b    P61_err
  605. ;    move.l    d0,a6
  606. ;    lea    P61_timerinterrupt(pc),a1
  607. ;    moveq    #0,d0
  608. ;    jsr    -6(a6)
  609. ;    tst.l    d0
  610. ;    beq.b    P61_gottimer
  611. ;    addq.l    #4,d3
  612. ;    lea    P61_timerinterrupt(pc),a1
  613. ;    moveq    #1,d0
  614. ;    jsr    -6(a6)
  615. ;    tst.l    d0
  616. ;    bne.b    P61_err
  617. ;
  618. ;P61_gottimer
  619.  
  620.     move.w    (sp)+,d3        ; timer a/b
  621.     add.w    d3,d3
  622.     add.w    d3,d3
  623.  
  624.     lea    P61_craddr+8(pc),a0
  625.     move.l    P61_ciaaddr(pc,d3),d0
  626.     move.l    d0,(a0)
  627.     sub    #$100,d0
  628.     move.l    d0,-(a0)
  629. ;    moveq    #2,d3
  630.     btst    #9,d0
  631.     bne.b    P61_timerB
  632. ;    subq.b    #1,d3
  633.     add    #$100,d0
  634. P61_timerB
  635.     add    #$900,d0
  636.     move.l    d0,-(a0)
  637.     move.l    d0,a0
  638.     and.b    #%10000000,(a0)
  639. ;    move.b    d3,P61_timeropen(a3)
  640.     moveq    #0,d0
  641.     ifne    CIA
  642.     move.l    P61_craddr+4(pc),a1
  643.     move.b    P61_tlo(pc),(a1)
  644.     move.b    P61_thi(pc),$100(a1)
  645.     endc
  646.     or.b    #$19,(a0)
  647. ;    st    P61_timeron(a3)
  648. ;P61_pois
  649. ;    move.l    (sp)+,a6
  650.  
  651.     movem.l    (sp)+,d2-d7/a2-a6
  652.     rts
  653.  
  654. ;P61_err    moveq    #-1,d0
  655. ;    bra.b    P61_pois
  656. ;    rts
  657.  
  658. P61_ciaaddr
  659.     dc.l    $bfd500,$bfd700
  660.     endc
  661.  
  662.  
  663. ; parameters modified for ROS usage
  664. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  665. ;­         Call P61_End to stop the music        ­
  666. ;­        Uses D0/D1/A0/A1        ­
  667. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  668.  
  669. P61_End    move.l    a6,-(sp)
  670.  
  671.     lea    $dff000,a6
  672.     moveq    #0,d0
  673.     move    d0,$a8(a6)
  674.     move    d0,$b8(a6)
  675.     move    d0,$c8(a6)
  676.     move    d0,$d8(a6)
  677.     move    #$f,$96(a6)
  678.  
  679.     and.b    #~2,$bfe001
  680.     move.b    P61_ofilter(pc),d0
  681.     or.b    d0,$bfe001
  682.  
  683.     ifeq    system
  684.     move    #$2000,$9a(a6)
  685.     move.l    P61_vektori(pc),a0
  686.     move.l    P61_oldlev6(pc),(a0)
  687.     lea    $bfd000,a0
  688.     lea    P61_timers(pc),a1
  689.     move.b    (a1)+,$400(a0)
  690.     move.b    (a1)+,$500(a0)
  691.     move.b    (a1)+,$600(a0)
  692.     move.b    (a1)+,$700(a0)
  693.     move.b    #$10,$e00(a0)
  694.     move.b    #$10,$f00(a0)
  695.  
  696.     else
  697.  
  698. * modified for use with ROS.lib
  699. ;    clr    P61_timeron(a3)
  700. ;    move.l    a6,-(sp)
  701. ;    lea    P61_cn(pc),a3
  702. ;    moveq    #0,d0
  703. ;    move.b    P61_timeropen(pc),d0
  704. ;    beq.b    P61_rem1
  705. ;    move.l    P61_ciares(pc),a6
  706. ;    lea    P61_timerinterrupt(pc),a1
  707. ;    subq.b    #1,d0
  708. ;    jsr    -12(a6)
  709. ;P61_rem1
  710. ;    move.l    4.w,a6
  711. ;    tst.b    P61_audioopen(a3)
  712. ;    beq.b    P61_rem2
  713. ;    lea    P61_allocreq(pc),a1
  714. ;    jsr    -$1c2(a6)
  715. ;    clr.b    P61_audioopen(a3)
  716. ;P61_rem2
  717. ;    moveq    #0,d0
  718. ;    move.b    P61_sigbit(pc),d0
  719. ;    bmi.b    P61_rem3
  720. ;    jsr    -$150(a6)
  721. ;    st    P61_sigbit(a3)
  722. ;P61_rem3
  723. ;    move.l    (sp)+,a6
  724.     endc
  725.  
  726.     move.l    (sp)+,a6
  727.     rts
  728.  
  729.     ifne    fade
  730. P61_mfade
  731.     move    P61_Master(pc),d0
  732.     move    P61_temp0+P61_Shadow(pc),d1
  733.     mulu    d0,d1
  734.     lsr    #6,d1
  735.     move    d1,$a8(a6)
  736.  
  737.     ifgt    channels-1
  738.     move    P61_temp1+P61_Shadow(pc),d1
  739.     mulu    d0,d1
  740.     lsr    #6,d1
  741.     move    d1,$b8(a6)
  742.     endc
  743.  
  744.     ifgt    channels-2
  745.     move    P61_temp2+P61_Shadow(pc),d1
  746.     mulu    d0,d1
  747.     lsr    #6,d1
  748.     move    d1,$c8(a6)
  749.     endc
  750.  
  751.     ifgt    channels-3
  752.     move    P61_temp3+P61_Shadow(pc),d1
  753.     mulu    d0,d1
  754.     lsr    #6,d1
  755.     move    d1,$d8(a6)
  756.     endc
  757.     rts
  758.     endc
  759.     
  760.  
  761. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  762. ;­ Call P61_SetPosition to jump to a specific    ­
  763. ;­          position in the song.        ­
  764. ;­ D0.l --> Position                ­
  765. ;­ Starts from the beginning if out of limits.    ­
  766. ;­              Uses A0/A1/A3/D0-D3        ­
  767. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  768.  
  769.     ifne    jump
  770. P61_SetPosition
  771.     lea    P61_cn(pc),a3
  772.     ifne    P61_pl
  773.     clr    P61_plflag(a3)
  774.     endc
  775.     moveq    #0,d1
  776.     move.b    d0,d1
  777.     move.l    d1,d0
  778.     cmp    P61_slen(a3),d0
  779.     blo.b    .e
  780.     moveq    #0,d0
  781. .e    move    d0,P61_Pos(a3)
  782.     add.l    P61_possibase(pc),d0
  783.     move.l    d0,P61_spos(a3)
  784.  
  785.     moveq    #64,d0
  786.     move    d0,P61_rowpos(a3)
  787.     clr    P61_CRow(a3)
  788.     move.l    P61_spos(pc),a1
  789.     move.l    P61_patternbase(pc),a0
  790.     addq    #1,P61_Pos(a3)
  791.     move.b    (a1)+,d0
  792.     move.l    a1,P61_spos(a3)
  793.     move.l    P61_positionbase(pc),a1
  794.     move    d0,P61_Patt(a3)
  795.     lsl    #3,d0
  796.     add.l    d0,a1
  797.     movem    (a1),d0-d3
  798.     lea    (a0,d0.l),a1
  799.     move    d1,d0
  800.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  801.     lea    (a0,d0.l),a1
  802.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  803.     move    d2,d0
  804.     lea    (a0,d0.l),a1
  805.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  806.     move    d3,d0
  807.     add.l    d0,a0
  808.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  809.     rts
  810.     endc
  811.  
  812. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  813. ;­ Call P61_Music every frame to play the music    ­
  814. ;­      _NOT_ if CIA-version is used!        ­
  815. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  816. ;­              Uses A0-A5/D0-D7        ­
  817. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  818.  
  819. P61_Music
  820.     lea    P61_cn(pc),a3
  821.  
  822.     tst    P61_Play(a3)
  823.     bne.b    P61_ohitaaa
  824.     ifne    CIA
  825.     ifne    system
  826.     move.l    P61_craddr+4(pc),a0
  827.     move.b    P61_tlo2(pc),(a0)
  828.     move.b    P61_thi2(pc),$100(a0)
  829.     endc
  830.     endc
  831.     rts
  832.  
  833. P61_ohitaaa
  834.     ifne    fade
  835.     pea    P61_mfade(pc)
  836.     endc
  837.  
  838.     moveq    #Channel_Block_SIZE,d6
  839.     moveq    #16,d7
  840.  
  841.     move    (a3),d4
  842.     addq    #1,d4
  843.     cmp    P61_speed(pc),d4
  844.     beq    P61_playtime
  845.  
  846.     move    d4,(a3)
  847.  
  848. P61_delay
  849.     ifne    CIA
  850.     ifne    system
  851.     move.l    P61_craddr+4(pc),a0
  852.     move.b    P61_tlo2(pc),(a0)
  853.     move.b    P61_thi2(pc),$100(a0)
  854.     endc
  855.     endc
  856.  
  857.     lea    P61_temp0(pc),a5
  858.     lea    $a0(a6),a4
  859.  
  860.     moveq    #channels-1,d5
  861. P61_lopas
  862.     tst    P61_OnOff(a5)
  863.     beq    P61_contfxdone
  864.     moveq    #$f,d0
  865.     and    (a5),d0
  866.     ifeq    opt020
  867.     add    d0,d0
  868.     move    P61_jtab2(pc,d0),d0
  869.     else
  870.     move    P61_jtab2(pc,d0*2),d0
  871.     endc
  872.     jmp    P61_jtab2(pc,d0)
  873.  
  874. P61_jtab2
  875.     dc    P61_contfxdone-P61_jtab2
  876.  
  877.     ifne    P61_pu
  878.     dc    P61_portup-P61_jtab2
  879.     else
  880.     dc    P61_contfxdone-P61_jtab2
  881.     endc
  882.  
  883.     ifne    P61_pd
  884.     dc    P61_portdwn-P61_jtab2
  885.     else
  886.     dc    P61_contfxdone-P61_jtab2
  887.     endc
  888.  
  889.     ifne    P61_tp
  890.     dc    P61_toneport-P61_jtab2
  891.     else
  892.     dc    P61_contfxdone-P61_jtab2
  893.     endc
  894.  
  895.     ifne    P61_vib
  896.     dc    P61_vib2-P61_jtab2
  897.     else
  898.     dc    P61_contfxdone-P61_jtab2
  899.     endc
  900.  
  901.     ifne    P61_tpvs
  902.     dc    P61_tpochvslide-P61_jtab2
  903.     else
  904.     dc    P61_contfxdone-P61_jtab2
  905.     endc
  906.  
  907.     ifne    P61_vbvs
  908.     dc    P61_vibochvslide-P61_jtab2
  909.     else
  910.     dc    P61_contfxdone-P61_jtab2
  911.     endc
  912.  
  913.     ifne    P61_tre
  914.     dc    P61_tremo-P61_jtab2
  915.     else
  916.     dc    P61_contfxdone-P61_jtab2
  917.     endc
  918.  
  919.     ifne    P61_arp
  920.     dc    P61_arpeggio-P61_jtab2
  921.     else
  922.     dc    P61_contfxdone-P61_jtab2
  923.     endc
  924.  
  925.     dc    P61_contfxdone-P61_jtab2
  926.  
  927.     ifne    P61_vs
  928.     dc    P61_volslide-P61_jtab2
  929.     else
  930.     dc    P61_contfxdone-P61_jtab2
  931.     endc
  932.  
  933.     dc    P61_contfxdone-P61_jtab2
  934.     dc    P61_contfxdone-P61_jtab2
  935.     dc    P61_contfxdone-P61_jtab2
  936.  
  937.     ifne    P61_ec
  938.     dc    P61_contecommands-P61_jtab2
  939.     else
  940.     dc    P61_contfxdone-P61_jtab2
  941.     endc
  942.     dc    P61_contfxdone-P61_jtab2
  943.  
  944.     ifne    P61_ec
  945. P61_contecommands
  946.     move.b    P61_Info(a5),d0
  947.     and    #$f0,d0
  948.     lsr    #3,d0
  949.     move    P61_etab2(pc,d0),d0
  950.     jmp    P61_etab2(pc,d0)
  951.  
  952. P61_etab2
  953.     dc    P61_contfxdone-P61_etab2
  954.  
  955.     ifne    P61_fsu
  956.     dc    P61_fineup2-P61_etab2
  957.     else
  958.     dc    P61_contfxdone-P61_etab2
  959.     endc
  960.  
  961.     ifne    P61_fsd
  962.     dc    P61_finedwn2-P61_etab2
  963.     else
  964.     dc    P61_contfxdone-P61_etab2
  965.     endc
  966.  
  967.     dc    P61_contfxdone-P61_etab2
  968.     dc    P61_contfxdone-P61_etab2
  969.  
  970.     dc    P61_contfxdone-P61_etab2
  971.     dc    P61_contfxdone-P61_etab2
  972.  
  973.     dc    P61_contfxdone-P61_etab2
  974.     dc    P61_contfxdone-P61_etab2
  975.  
  976.     ifne    P61_rt
  977.     dc    P61_retrig-P61_etab2
  978.     else
  979.     dc    P61_contfxdone-P61_etab2
  980.     endc
  981.  
  982.     ifne    P61_fvu
  983.     dc    P61_finevup2-P61_etab2
  984.     else
  985.     dc    P61_contfxdone-P61_etab2
  986.     endc
  987.  
  988.     ifne    P61_fvd
  989.     dc    P61_finevdwn2-P61_etab2
  990.     else
  991.     dc    P61_contfxdone-P61_etab2
  992.     endc
  993.  
  994.     ifne    P61_nc
  995.     dc    P61_notecut-P61_etab2
  996.     else
  997.     dc    P61_contfxdone-P61_etab2
  998.     endc
  999.  
  1000.     ifne    P61_nd
  1001.     dc    P61_notedelay-P61_etab2
  1002.     else
  1003.     dc    P61_contfxdone-P61_etab2
  1004.     endc
  1005.  
  1006.     dc    P61_contfxdone-P61_etab2
  1007.     dc    P61_contfxdone-P61_etab2
  1008.     endc
  1009.  
  1010.     ifne    P61_fsu
  1011. P61_fineup2
  1012.     tst    (a3)
  1013.     bne    P61_contfxdone
  1014.     moveq    #$f,d0
  1015.     and.b    P61_Info(a5),d0
  1016.     sub    d0,P61_Period(a5)
  1017.     moveq    #113,d0
  1018.     cmp    P61_Period(a5),d0
  1019.     ble.b    .jup
  1020.     move    d0,P61_Period(a5)
  1021. .jup    move    P61_Period(a5),6(a4)
  1022.     bra    P61_contfxdone
  1023.     endc
  1024.  
  1025.     ifne    P61_fsd
  1026. P61_finedwn2
  1027.     tst    (a3)
  1028.     bne    P61_contfxdone
  1029.     moveq    #$f,d0
  1030.     and.b    P61_Info(a5),d0
  1031.     add    d0,P61_Period(a5)
  1032.     cmp    #856,P61_Period(a5)
  1033.     ble.b    .jup
  1034.     move    #856,P61_Period(a5)
  1035. .jup    move    P61_Period(a5),6(a4)
  1036.     bra    P61_contfxdone
  1037.     endc
  1038.  
  1039.     ifne    P61_fvu
  1040. P61_finevup2
  1041.     tst    (a3)
  1042.     bne    P61_contfxdone
  1043.     moveq    #$f,d0
  1044.     and.b    P61_Info(a5),d0
  1045.     add    d0,P61_Volume(a5)
  1046.     moveq    #64,d0
  1047.     cmp    P61_Volume(a5),d0
  1048.     bge.b    .jup
  1049.     move    d0,P61_Volume(a5)
  1050. .jup    move    P61_Volume(a5),8(a4)
  1051.     bra    P61_contfxdone
  1052.     endc
  1053.  
  1054.     ifne    P61_fvd
  1055. P61_finevdwn2
  1056.     tst    (a3)
  1057.     bne    P61_contfxdone
  1058.     moveq    #$f,d0
  1059.     and.b    P61_Info(a5),d0
  1060.     sub    d0,P61_Volume(a5)
  1061.     bpl.b    .jup
  1062.     clr    P61_Volume(a5)
  1063. .jup    move    P61_Volume(a5),8(a4)
  1064.     bra    P61_contfxdone
  1065.     endc
  1066.  
  1067.     ifne    P61_nc
  1068. P61_notecut
  1069.     moveq    #$f,d0
  1070.     and.b    P61_Info(a5),d0
  1071.     cmp    (a3),d0
  1072.     bne    P61_contfxdone
  1073.     ifeq    fade
  1074.     clr    8(a4)
  1075.     else
  1076.     clr    P61_Shadow(a5)
  1077.     endc
  1078.     clr    P61_Volume(a5)
  1079.     bra    P61_contfxdone
  1080.     endc
  1081.  
  1082.     ifne    P61_nd
  1083. P61_notedelay
  1084.     moveq    #$f,d0
  1085.     and.b    P61_Info(a5),d0
  1086.     cmp    (a3),d0
  1087.     bne    P61_contfxdone
  1088.  
  1089.     moveq    #$7e,d0
  1090.     and.b    (a5),d0
  1091.     beq    P61_contfxdone
  1092.     move    P61_DMABit(a5),d0
  1093.     move    d0,$96(a6)
  1094.     or    d0,P61_dma(a3)
  1095.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1096.     move.l    (a1)+,(a4)+            ;Pointer
  1097.     move    (a1),(a4)+            ;Length
  1098.     move    P61_Period(a5),(a4)
  1099.     subq.l    #6,a4
  1100.  
  1101.     ifeq    system
  1102.     lea    P61_dmason(pc),a1
  1103.     move.l    P61_vektori(pc),a0
  1104.     move.l    a1,(a0)
  1105.     move.b    #$f0,$bfd600
  1106.     move.b    #$01,$bfd700
  1107.     move.b    #$19,$bfdf00
  1108.     else
  1109.     move    #1,P61_server(a3)
  1110.     move.l    P61_craddr+4(pc),a1
  1111.     move.b    #$f0,(a1)
  1112.     move.b    #1,$100(a1)
  1113.     endc
  1114.     bra    P61_contfxdone
  1115.     endc
  1116.  
  1117.     ifne    P61_rt
  1118. P61_retrig
  1119.     subq    #1,P61_RetrigCount(a5)
  1120.     bne    P61_contfxdone
  1121.     move    P61_DMABit(a5),d0
  1122.     move    d0,$96(a6)
  1123.     or    d0,P61_dma(a3)
  1124.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1125.     move.l    (a1)+,(a4)            ;Pointer
  1126.     move    (a1),4(a4)            ;Length
  1127.  
  1128.     ifeq    system
  1129.     lea    P61_dmason(pc),a1
  1130.     move.l    P61_vektori(pc),a0
  1131.     move.l    a1,(a0)
  1132.     move.b    #$f0,$bfd600
  1133.     move.b    #$01,$bfd700
  1134.     move.b    #$19,$bfdf00
  1135.     else
  1136.     move    #1,P61_server(a3)
  1137.     move.l    P61_craddr+4(pc),a1
  1138.     move.b    #$f0,(a1)
  1139.     move.b    #1,$100(a1)
  1140.     endc
  1141.  
  1142.     moveq    #$f,d0
  1143.     and.b    P61_Info(a5),d0
  1144.     move    d0,P61_RetrigCount(a5)
  1145.     bra    P61_contfxdone
  1146.     endc
  1147.  
  1148.     ifne    P61_arp
  1149. P61_arplist
  1150.  dc.b 0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1
  1151.  
  1152. P61_arpeggio
  1153.     move    (a3),d0
  1154.     move.b    P61_arplist(pc,d0),d0
  1155.     beq.b    .arp0
  1156.     bmi.b    .arp1
  1157.  
  1158.     move.b    P61_Info(a5),d0
  1159.     lsr    #4,d0
  1160.     bra.b    .arp3
  1161.  
  1162. .arp0    move    P61_Note(a5),d0
  1163.     move    P61_periods(pc,d0),6(a4)
  1164.     bra    P61_contfxdone
  1165.  
  1166. .arp1    moveq    #$f,d0
  1167.     and.b    P61_Info(a5),d0
  1168.  
  1169. .arp3    add    d0,d0
  1170.     add    P61_Note(a5),d0
  1171.     move    P61_periods(pc,d0),6(a4)
  1172.     bra    P61_contfxdone
  1173.     endc
  1174.  
  1175. P61_periods
  1176.     ifne    P61_ft
  1177.     incbin    player/periods
  1178.     else
  1179.     incbin    player/periods.nft
  1180.     endc
  1181.  
  1182.     ifne    P61_vs
  1183. P61_volslide
  1184.     move.b    P61_Info(a5),d0
  1185.     sub.b    d0,P61_Volume+1(a5)
  1186.     bpl.b    .test
  1187.     clr    P61_Volume(a5)
  1188.     ifeq    fade
  1189.     clr    8(a4)
  1190.     else
  1191.     clr    P61_Shadow(a5)
  1192.     endc
  1193.     bra    P61_contfxdone
  1194. .test    moveq    #64,d0
  1195.     cmp    P61_Volume(a5),d0
  1196.     bge.b    .ncs
  1197.     move    d0,P61_Volume(a5)
  1198.     ifeq    fade
  1199.     move    d0,8(a4)
  1200.     else
  1201.     move    d0,P61_Shadow(a5)
  1202.     endc
  1203.     bra.b    P61_contfxdone
  1204. .ncs    ifeq    fade
  1205.     move    P61_Volume(a5),8(a4)
  1206.     else
  1207.     move    P61_Volume(a5),P61_Shadow(a5)
  1208.     endc
  1209.     bra.b    P61_contfxdone
  1210.     endc
  1211.  
  1212.     ifne    P61_tpvs
  1213. P61_tpochvslide
  1214.     move.b    P61_Info(a5),d0
  1215.     sub.b    d0,P61_Volume+1(a5)
  1216.     bpl.b    .test
  1217.     clr    P61_Volume(a5)
  1218.     ifeq    fade
  1219.     clr    8(a4)
  1220.     else
  1221.     clr    P61_Shadow(a5)
  1222.     endc
  1223.     bra.b    P61_toneport
  1224. .test    moveq    #64,d0
  1225.     cmp    P61_Volume(a5),d0
  1226.     bge.b    .ncs
  1227.     move    d0,P61_Volume(a5)
  1228. .ncs    ifeq    fade
  1229.     move    P61_Volume(a5),8(a4)
  1230.     else
  1231.     move    P61_Volume(a5),P61_Shadow(a5)
  1232.     endc
  1233.     endc
  1234.  
  1235.     ifne    P61_tp
  1236. P61_toneport
  1237.     move    P61_ToPeriod(a5),d0
  1238.     beq.b    P61_contfxdone
  1239.     move    P61_TPSpeed(a5),d1
  1240.     cmp    P61_Period(a5),d0
  1241.     blt.b    .topoup
  1242.  
  1243.     add    d1,P61_Period(a5)
  1244.     cmp    P61_Period(a5),d0
  1245.     bgt.b    .setper
  1246.     move    d0,P61_Period(a5)
  1247.     clr    P61_ToPeriod(a5)
  1248.     move    d0,6(a4)
  1249.     bra.b    P61_contfxdone
  1250.  
  1251. .topoup
  1252.     sub    d1,P61_Period(a5)
  1253.     cmp    P61_Period(a5),d0
  1254.     blt.b    .setper
  1255.     move    d0,P61_Period(a5)
  1256.     clr    P61_ToPeriod(a5)
  1257. .setper
  1258.     move    P61_Period(a5),6(a4)
  1259.     else
  1260.     nop
  1261.     endc
  1262.  
  1263. P61_contfxdone
  1264.     ifne    P61_il
  1265.     bsr    P61_funk2
  1266.     endc
  1267.  
  1268.     add.l    d6,a5
  1269.     add.l    d7,a4
  1270.     dbf    d5,P61_lopas
  1271.  
  1272.     cmp    P61_speed2(pc),d4
  1273.     beq.b    P61_preplay
  1274.     rts
  1275.  
  1276.     ifne    P61_pu
  1277. P61_portup
  1278.     moveq    #0,D0
  1279.     move.b    P61_Info(a5),d0
  1280.     sub    d0,P61_Period(a5)
  1281.     moveq    #113,d0
  1282.     cmp    P61_Period(a5),d0
  1283.     ble.b    .skip
  1284.     move    d0,P61_Period(a5)
  1285.     move    d0,6(a4)
  1286.     bra.b    P61_contfxdone
  1287. .skip
  1288.     move    P61_Period(a5),6(a4)
  1289.     bra.b    P61_contfxdone
  1290.     endc
  1291.  
  1292.     ifne    P61_pd
  1293. P61_portdwn
  1294.     moveq    #0,d0
  1295.     move.b    P61_Info(a5),d0
  1296.     add    d0,P61_Period(a5)
  1297.     cmp    #856,P61_Period(a5)
  1298.     ble.b    .skip
  1299.     move    #856,d0
  1300.     move    d0,P61_Period(a5)
  1301.     move    d0,6(a4)
  1302.     bra.b    P61_contfxdone
  1303. .skip
  1304.     move    P61_Period(a5),6(a4)
  1305.     bra.b    P61_contfxdone
  1306.     endc
  1307.  
  1308.     ifne    P61_pde
  1309. P61_return
  1310.     rts
  1311.  
  1312. P61_preplay
  1313.     tst    P61_pdflag(a3)
  1314.     bne.b    P61_return
  1315.     else
  1316. P61_preplay
  1317.     endc
  1318.  
  1319.     lea    P61_temp0(pc),a5
  1320.     lea    P61_samples-16(pc),a0
  1321.  
  1322.     moveq    #channels-1,d5
  1323. P61_loaps
  1324.     ifne    P61_pl
  1325.     lea    P61_TData(a5),a1
  1326.     move    2(a5),(a1)+
  1327.     move.l    P61_ChaPos(a5),(a1)+
  1328.     move.l    P61_TempPos(a5),(a1)+
  1329.     move    P61_TempLen(a5),(a1)
  1330.     endc
  1331.  
  1332.     move.b    P61_Pack(a5),d0
  1333.     and.b    #$3f,d0
  1334.     beq.b    P61_takeone
  1335.  
  1336.     tst.b    P61_Pack(a5)
  1337.     bmi.b    .keepsame
  1338.  
  1339.     subq.b    #1,P61_Pack(a5)
  1340.     clr    P61_OnOff(a5)            ; Empty row
  1341.     add.l    d6,a5
  1342.     dbf    d5,P61_loaps
  1343.     rts
  1344.  
  1345. .keepsame
  1346.     subq.b    #1,P61_Pack(a5)
  1347.     bra    P61_dko
  1348.  
  1349. P61_takeone
  1350.     tst.b    P61_TempLen+1(a5)
  1351.     beq    P61_takenorm
  1352.  
  1353.     subq.b    #1,P61_TempLen+1(a5)
  1354.     move.l    P61_TempPos(a5),a2
  1355.  
  1356. P61_jedi
  1357.     move.b    (a2)+,d0
  1358.     moveq    #%01100000,d1
  1359.     and.b    d0,d1
  1360.     cmp.b    #%01100000,d1
  1361.     bne.b    .all
  1362.  
  1363.     moveq    #%01110000,d1
  1364.     and.b    d0,d1
  1365.     cmp.b    #%01110000,d1
  1366.     bne.b    .cmd
  1367.  
  1368.     moveq    #%01111000,d1
  1369.     and.b    d0,d1
  1370.     cmp.b    #%01111000,d1
  1371.     bne.b    .note
  1372.  
  1373. .empty    clr    P61_OnOff(a5)            ; Empty row
  1374.     clr    (a5)+
  1375.     clr.b    (a5)+
  1376.     tst.b    d0
  1377.     bpl.b    .ex
  1378.     move.b    (a2)+,(a5)            ; Compression info
  1379.     bra.b    .ex
  1380.  
  1381. .all    move.b    d0,(a5)+
  1382.     ifeq    opt020
  1383.     move.b    (a2)+,(a5)+
  1384.     move.b    (a2)+,(a5)+
  1385.     else
  1386.     move    (a2)+,(a5)+
  1387.     endc
  1388.     tst.b    d0
  1389.     bpl.b    .ex
  1390.     move.b    (a2)+,(a5)            ; Compression info
  1391.     bra.b    .ex
  1392.  
  1393. .cmd    moveq    #$f,d1
  1394.     and    d0,d1
  1395.     move    d1,(a5)+            ; cmd
  1396.     move.b    (a2)+,(a5)+            ; info
  1397.     tst.b    d0
  1398.     bpl.b    .ex
  1399.     move.b    (a2)+,(a5)            ; Compression info
  1400.     bra.b    .ex
  1401.  
  1402. .note    moveq    #7,d1
  1403.     and    d0,d1
  1404.     lsl    #8,d1
  1405.     move.b    (a2)+,d1
  1406.     lsl    #4,d1
  1407.     move    d1,(a5)+
  1408.     clr.b    (a5)+    
  1409.     tst.b    d0
  1410.     bpl.b    .ex
  1411.     move.b    (a2)+,(a5)            ; Compression info
  1412. .ex    subq.l    #3,a5
  1413.     move.l    a2,P61_TempPos(a5)
  1414.     bra    P61_dko
  1415.  
  1416.  
  1417. P61_takenorm
  1418.     move.l    P61_ChaPos(a5),a2
  1419.  
  1420.     move.b    (a2)+,d0
  1421.     moveq    #%01100000,d1
  1422.     and.b    d0,d1
  1423.     cmp.b    #%01100000,d1
  1424.     bne.b    .all
  1425.  
  1426.     moveq    #%01110000,d1
  1427.     and.b    d0,d1
  1428.     cmp.b    #%01110000,d1
  1429.     bne.b    .cmd
  1430.  
  1431.     moveq    #%01111000,d1
  1432.     and.b    d0,d1
  1433.     cmp.b    #%01111000,d1
  1434.     bne.b    .note
  1435.  
  1436. .empty    clr    P61_OnOff(a5)            ; Empty row
  1437.     clr    (a5)+
  1438.     clr.b    (a5)+
  1439.     tst.b    d0
  1440.     bpl.b    .proccomp
  1441.     move.b    (a2)+,(a5)            ; Compression info
  1442.     bra.b    .proccomp
  1443.  
  1444.  
  1445. .all    move.b    d0,(a5)+
  1446.     ifeq    opt020
  1447.     move.b    (a2)+,(a5)+
  1448.     move.b    (a2)+,(a5)+
  1449.     else
  1450.     move    (a2)+,(a5)+
  1451.     endc
  1452.     tst.b    d0
  1453.     bpl.b    .proccomp
  1454.     move.b    (a2)+,(a5)            ; Compression info
  1455.     bra.b    .proccomp
  1456.  
  1457. .cmd    moveq    #$f,d1
  1458.     and    d0,d1
  1459.     move    d1,(a5)+            ; cmd
  1460.     move.b    (a2)+,(a5)+            ; info
  1461.     tst.b    d0
  1462.     bpl.b    .proccomp
  1463.     move.b    (a2)+,(a5)            ; Compression info
  1464.     bra.b    .proccomp
  1465.  
  1466. .note    moveq    #7,d1
  1467.     and    d0,d1
  1468.     lsl    #8,d1
  1469.     move.b    (a2)+,d1
  1470.     lsl    #4,d1
  1471.     move    d1,(a5)+
  1472.     clr.b    (a5)+    
  1473.     tst.b    d0
  1474.     bpl.b    .proccomp
  1475.     move.b    (a2)+,(a5)            ; Compression info
  1476.  
  1477. .proccomp
  1478.     subq.l    #3,a5
  1479.     move.l    a2,P61_ChaPos(a5)
  1480.  
  1481.     tst.b    d0
  1482.     bpl.b    P61_dko
  1483.  
  1484.     move.b    3(a5),d0
  1485.     move.b    d0,d1
  1486.     and    #%11000000,d1
  1487.     beq.b    P61_dko                ; Empty datas
  1488.     cmp.b    #%10000000,d1
  1489.     beq.b    P61_dko                ; Same datas
  1490.  
  1491.     clr.b    3(a5)
  1492.     and    #$3f,d0
  1493.     move.b    d0,P61_TempLen+1(a5)
  1494.  
  1495.     cmp.b    #%11000000,d1
  1496.     beq.b    .bit16                ; 16-bit
  1497.  
  1498.     moveq    #0,d0                ; 8-bit
  1499.     move.b    (a2)+,d0
  1500.     move.l    a2,P61_ChaPos(a5)
  1501.     sub.l    d0,a2
  1502.     bra    P61_jedi
  1503.  
  1504. .bit16    moveq    #0,d0
  1505.     ifeq    opt020
  1506.     move.b    (a2)+,d0
  1507.     lsl    #8,d0
  1508.     move.b    (a2)+,d0
  1509.     else
  1510.     move    (a2)+,d0
  1511.     endc
  1512.  
  1513.     move.l    a2,P61_ChaPos(a5)
  1514.     sub.l    d0,a2
  1515.     bra    P61_jedi
  1516.  
  1517.  
  1518. P61_dko    st    P61_OnOff(a5)
  1519.     move    (a5),d0
  1520.     and    #$1f0,d0
  1521.     beq.b    .koto
  1522.     lea    (a0,d0),a1
  1523.     move.l    a1,P61_Sample(a5)
  1524.     ifne    P61_ft
  1525.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1526.     else
  1527.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1528.     endc
  1529.     ifne    P61_il
  1530.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1531.     endc
  1532.     ifne    P61_sof
  1533.     clr    P61_Offset(a5)
  1534.     endc
  1535.  
  1536. .koto    add.l    d6,a5
  1537.     dbf    d5,P61_loaps
  1538.     rts
  1539.  
  1540. P61_playtime
  1541.     clr    (a3)
  1542.  
  1543.     ifne    P61_pde
  1544.     tst    P61_pdelay(a3)
  1545.     beq.b    .djdj
  1546.     subq    #1,P61_pdelay(a3)
  1547.     bne    P61_delay
  1548.     tst    P61_speedis1(a3)
  1549.     bne    P61_delay
  1550.     clr    P61_pdflag(a3)
  1551.     bra    P61_delay
  1552. .djdj
  1553.     clr    P61_pdflag(a3)
  1554.     endc
  1555.  
  1556.     tst    P61_speedis1(a3)
  1557.     beq.b    .mo
  1558.     bsr    P61_preplay
  1559.  
  1560. .mo    lea    P61_temp0(pc),a5
  1561.     lea    $a0(a6),a4
  1562.  
  1563.     ifeq    system
  1564.     lea    P61_dmason(pc),a1
  1565.     move.l    P61_vektori(pc),a0
  1566.     move.l    a1,(a0)
  1567.     move.b    #$f0,$bfd600
  1568.     move.b    #$01,$bfd700
  1569.     move.b    #$19,$bfdf00
  1570.     else
  1571.     move    #1,P61_server(a3)
  1572.     move.l    P61_craddr+4(pc),a1
  1573.     move.b    #$f0,(a1)
  1574.     move.b    #1,$100(a1)
  1575.     endc
  1576.  
  1577.     lea    P61_periods(pc),a2
  1578.  
  1579.     moveq    #0,d4
  1580.     moveq    #channels-1,d5
  1581. P61_los    tst    P61_OnOff(a5)
  1582.     beq    P61_nocha
  1583.  
  1584.     moveq    #$f,d0
  1585.     and    (a5),d0
  1586.     lea    P61_jtab(pc),a1
  1587.     add    d0,d0
  1588.     add.l    d0,a1
  1589.     add    (a1),a1
  1590.     jmp    (a1)
  1591.  
  1592. P61_fxdone
  1593.     moveq    #$7e,d0
  1594.     and.b    (a5),d0
  1595.     beq.b    P61_nocha
  1596.     ifne    P61_vib
  1597.     clr.b    P61_VibPos(a5)
  1598.     endc
  1599.     ifne    P61_tre
  1600.     clr.b    P61_TrePos(a5)
  1601.     endc
  1602.  
  1603.      ifne    P61_ft
  1604.     add    P61_Fine(a5),d0
  1605.     endc
  1606.     move    d0,P61_Note(a5)
  1607.     move    (a2,d0),P61_Period(a5)
  1608.  
  1609. P61_zample
  1610.     ifne    P61_sof
  1611.     tst    P61_Offset(a5)
  1612.     bne    P61_pek
  1613.     endc
  1614.  
  1615.     or    P61_DMABit(a5),d4
  1616.     move    d4,$96(a6)
  1617.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1618.     move.l    (a1)+,(a4)            ;Pointer
  1619.     move    (a1),4(a4)            ;Length
  1620.  
  1621. P61_nocha
  1622.     ifeq    fade
  1623.     move.l    P61_Period(a5),6(a4)
  1624.     else
  1625.     move    P61_Period(a5),6(a4)
  1626.     move    P61_Volume(a5),P61_Shadow(a5)
  1627.     endc
  1628.  
  1629. P61_skip
  1630.     ifne    P61_il
  1631.     bsr    P61_funk2
  1632.     endc
  1633.  
  1634.     add.l    d6,a5
  1635.     add.l    d7,a4
  1636.     dbf    d5,P61_los
  1637.  
  1638.     move.b    d4,P61_dma+1(a3)
  1639.  
  1640.     ifne    P61_pl
  1641.     tst.b    P61_plflag+1(a3)
  1642.     beq.b    P61_ohittaa
  1643.  
  1644.     lea    P61_temp0(pc),a1
  1645.     lea    P61_looppos(pc),a0
  1646.     moveq    #channels-1,d0
  1647. .talt    move.b    1(a0),3(a1)
  1648.     addq.l    #2,a0
  1649.     move.l    (a0)+,P61_ChaPos(a1)
  1650.     move.l    (a0)+,P61_TempPos(a1)
  1651.     move    (a0)+,P61_TempLen(a1)
  1652.     add.l    d6,a1
  1653.     dbf    d0,.talt
  1654.  
  1655.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1656.     clr.b    P61_plflag+1(a3)
  1657.     moveq    #63,d0
  1658.     sub    P61_rowpos(a3),d0
  1659.     move    d0,P61_CRow(a3)
  1660.     rts
  1661.     endc
  1662.  
  1663. P61_ohittaa
  1664.     subq    #1,P61_rowpos(a3)
  1665.     bmi.b    P61_nextpattern
  1666.     moveq    #63,d0
  1667.     sub    P61_rowpos(a3),d0
  1668.     move    d0,P61_CRow(a3)
  1669.     rts
  1670.  
  1671. P61_nextpattern
  1672.     ifne    P61_pl
  1673.     clr    P61_plflag(a3)
  1674.     endc
  1675.     move.l    P61_patternbase(pc),a4
  1676.     moveq    #63,d0
  1677.     move    d0,P61_rowpos(a3)
  1678.     clr    P61_CRow(a3)
  1679.     move.l    P61_spos(pc),a1
  1680.     addq    #1,P61_Pos(a3)
  1681.     move.b    (a1)+,d0
  1682.     bpl.b    P61_dk
  1683.     move.l    P61_possibase(pc),a1
  1684.     move.b    (a1)+,d0
  1685.     clr    P61_Pos(a3)
  1686. P61_dk    move.l    a1,P61_spos(a3)
  1687.     move    d0,P61_Patt(a3)
  1688.     lsl    #3,d0
  1689.     move.l    P61_positionbase(pc),a1
  1690.     add.l    d0,a1
  1691.  
  1692.     move    (a1)+,d0
  1693.     lea    (a4,d0.l),a2
  1694.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1695.     move    (a1)+,d0
  1696.     lea    (a4,d0.l),a2
  1697.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1698.     move    (a1)+,d0
  1699.     lea    (a4,d0.l),a2
  1700.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1701.     move    (a1),d0
  1702.     add.l    d0,a4
  1703.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1704.     rts
  1705.  
  1706.     ifne    P61_tp
  1707. P61_settoneport
  1708.     move.b    P61_Info(a5),d0
  1709.     beq.b    P61_toponochange
  1710.     move.b    d0,P61_TPSpeed+1(a5)
  1711. P61_toponochange
  1712.     moveq    #$7e,d0
  1713.     and.b    (a5),d0
  1714.     beq    P61_nocha
  1715.     add    P61_Fine(a5),d0
  1716.     move    d0,P61_Note(a5)
  1717.     move    (a2,d0),P61_ToPeriod(a5)
  1718.     bra    P61_nocha
  1719.     endc
  1720.  
  1721.     ifne    P61_sof
  1722. P61_sampleoffse
  1723.     moveq    #0,d1
  1724.     move    #$ff00,d1
  1725.     and    2(a5),d1
  1726.     bne.b    .deq
  1727.     move    P61_LOffset(a5),d1
  1728. .deq    move    d1,P61_LOffset(a5)
  1729.     add    d1,P61_Offset(a5)
  1730.  
  1731.     moveq    #$7e,d0
  1732.     and.b    (a5),d0
  1733.     beq    P61_nocha
  1734.  
  1735.     move    P61_Offset(a5),d2
  1736.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1737.     move    d2,d1
  1738.  
  1739.     ifne    P61_vib
  1740.     clr.b    P61_VibPos(a5)
  1741.     endc
  1742.     ifne    P61_tre
  1743.     clr.b    P61_TrePos(a5)
  1744.     endc
  1745.  
  1746.     ifne    P61_ft
  1747.     add    P61_Fine(a5),d0
  1748.     endc
  1749.     move    d0,P61_Note(a5)
  1750.     move    (a2,d0),P61_Period(a5)
  1751.     bra.b    P61_hup
  1752.  
  1753. P61_pek    moveq    #0,d1
  1754.     move    P61_Offset(a5),d1
  1755. P61_hup    or    P61_DMABit(a5),d4
  1756.     move    d4,$96(a6)
  1757.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1758.     move.l    (a1)+,d0
  1759.     add.l    d1,d0
  1760.     move.l    d0,(a4)                ;Pointer
  1761.     lsr    #1,d1
  1762.     move    (a1),d0
  1763.     sub    d1,d0
  1764.     bpl.b    P61_offok
  1765.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1766.     moveq    #1,d0
  1767. P61_offok
  1768.     move    d0,4(a4)            ;Length
  1769.     bra    P61_nocha
  1770.     endc
  1771.  
  1772.     ifne    P61_vl
  1773. P61_volum
  1774.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1775.     bra    P61_fxdone
  1776.     endc
  1777.  
  1778.     ifne    P61_pj
  1779. P61_posjmp
  1780.     moveq    #0,d0
  1781.     move.b    P61_Info(a5),d0
  1782.     cmp    P61_slen(a3),d0
  1783.     blo.b    .e
  1784.     moveq    #0,d0
  1785. .e    move    d0,P61_Pos(a3)
  1786.     add.l    P61_possibase(pc),d0
  1787.     move.l    d0,P61_spos(a3)
  1788.     endc
  1789.  
  1790.     ifne    P61_pb
  1791. P61_pattbreak
  1792.     moveq    #64,d0
  1793.     move    d0,P61_rowpos(a3)
  1794.     clr    P61_CRow(a3)
  1795.     move.l    P61_spos(pc),a1
  1796.     move.l    P61_patternbase(pc),a0
  1797.     addq    #1,P61_Pos(a3)
  1798.     move.b    (a1)+,d0
  1799.     bpl.b    P61_dk2
  1800.     move.l    P61_possibase(pc),a1
  1801.     move.b    (a1)+,d0
  1802.     clr    P61_Pos(a3)
  1803. P61_dk2    move.l    a1,P61_spos(a3)
  1804.     move.l    P61_positionbase(pc),a1
  1805.     move    d0,P61_Patt(a3)
  1806.     lsl    #3,d0
  1807.     add.l    d0,a1
  1808.     movem    (a1),d0-d3
  1809.     lea    (a0,d0.l),a1
  1810.     move    d1,d0
  1811.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  1812.     lea    (a0,d0.l),a1
  1813.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  1814.     move    d2,d0
  1815.     lea    (a0,d0.l),a1
  1816.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1817.     move    d3,d0
  1818.     add.l    d0,a0
  1819.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1820.     bra    P61_fxdone
  1821.     endc
  1822.  
  1823.     ifne    P61_vib
  1824. P61_vibrato
  1825.     move.b    P61_Info(a5),d0
  1826.     beq    P61_fxdone
  1827.     move.b    d0,d1
  1828.     move.b    P61_VibCmd(a5),d2
  1829.     and.b    #$f,d0
  1830.     beq.b    P61_vibskip
  1831.     and.b    #$f0,d2
  1832.     or.b    d0,d2
  1833. P61_vibskip
  1834.     and.b    #$f0,d1
  1835.     beq.b    P61_vibskip2
  1836.     and.b    #$f,d2
  1837.     or.b    d1,d2
  1838. P61_vibskip2
  1839.     move.b    d2,P61_VibCmd(a5)
  1840.     bra    P61_fxdone
  1841.     endc
  1842.  
  1843.     ifne    P61_tre
  1844. P61_settremo
  1845.     move.b    P61_Info(a5),d0
  1846.     beq    P61_fxdone
  1847.     move.b    d0,d1
  1848.     move.b    P61_TreCmd(a5),d2
  1849.     moveq    #$f,d3
  1850.     and.b    d3,d0
  1851.     beq.b    P61_treskip
  1852.     and.b    #$f0,d2
  1853.     or.b    d0,d2
  1854. P61_treskip
  1855.     and.b    #$f0,d1
  1856.     beq.b    P61_treskip2
  1857.     and.b    d3,d2
  1858.     or.b    d1,d2
  1859. P61_treskip2
  1860.     move.b    d2,P61_TreCmd(a5)
  1861.     bra    P61_fxdone
  1862.     endc
  1863.  
  1864.     ifne    P61_ec
  1865. P61_ecommands
  1866.     move.b    P61_Info(a5),d0
  1867.     and.b    #$f0,d0
  1868.     lsr    #3,d0
  1869.     move    P61_etab(pc,d0),d0
  1870.     jmp    P61_etab(pc,d0)
  1871.  
  1872. P61_etab
  1873.     ifne    P61_fi
  1874.     dc    P61_filter-P61_etab
  1875.     else
  1876.     dc    P61_fxdone-P61_etab
  1877.     endc
  1878.  
  1879.     ifne    P61_fsu
  1880.     dc    P61_fineup-P61_etab
  1881.     else
  1882.     dc    P61_fxdone-P61_etab
  1883.     endc
  1884.  
  1885.     ifne    P61_fsd
  1886.     dc    P61_finedwn-P61_etab
  1887.     else
  1888.     dc    P61_fxdone-P61_etab
  1889.     endc
  1890.  
  1891.     dc    P61_fxdone-P61_etab
  1892.     dc    P61_fxdone-P61_etab
  1893.  
  1894.     ifne    P61_sft
  1895.     dc    P61_setfinetune-P61_etab
  1896.     else
  1897.     dc    P61_fxdone-P61_etab
  1898.     endc
  1899.  
  1900.     ifne    P61_pl
  1901.     dc    P61_patternloop-P61_etab
  1902.     else
  1903.     dc    P61_fxdone-P61_etab
  1904.     endc
  1905.  
  1906.     dc    P61_fxdone-P61_etab
  1907.  
  1908.     ifne    P61_timing
  1909.     dc    P61_sete8-P61_etab
  1910.     else
  1911.     dc    P61_fxdone-P61_etab
  1912.     endc
  1913.  
  1914.     ifne    P61_rt
  1915.     dc    P61_setretrig-P61_etab
  1916.     else
  1917.     dc    P61_fxdone-P61_etab
  1918.     endc
  1919.  
  1920.     ifne    P61_fvu
  1921.     dc    P61_finevup-P61_etab
  1922.     else
  1923.     dc    P61_fxdone-P61_etab
  1924.     endc
  1925.  
  1926.     ifne    P61_fvd
  1927.     dc    P61_finevdwn-P61_etab
  1928.     else
  1929.     dc    P61_fxdone-P61_etab
  1930.     endc
  1931.  
  1932.     dc    P61_fxdone-P61_etab
  1933.  
  1934.     ifne    P61_nd
  1935.     dc    P61_ndelay-P61_etab
  1936.     else
  1937.     dc    P61_fxdone-P61_etab
  1938.     endc
  1939.  
  1940.     ifne    P61_pde
  1941.     dc    P61_pattdelay-P61_etab
  1942.     else
  1943.     dc    P61_fxdone-P61_etab
  1944.     endc
  1945.  
  1946.     ifne    P61_il
  1947.     dc    P61_funk-P61_etab
  1948.     else
  1949.     dc    P61_fxdone-P61_etab
  1950.     endc
  1951.     endc
  1952.  
  1953.     ifne    P61_fi
  1954. P61_filter
  1955.     move.b    P61_Info(a5),d0
  1956.     and.b    #$fd,$bfe001
  1957.     or.b    d0,$bfe001
  1958.     bra    P61_fxdone
  1959.     endc
  1960.  
  1961.     ifne    P61_fsu
  1962. P61_fineup
  1963.     P61_getnote
  1964.  
  1965.     moveq    #$f,d0
  1966.     and.b    P61_Info(a5),d0
  1967.     sub    d0,P61_Period(a5)
  1968.     moveq    #113,d0
  1969.     cmp    P61_Period(a5),d0
  1970.     ble.b    .jup
  1971.     move    d0,P61_Period(a5)
  1972. .jup    moveq    #$7e,d0
  1973.     and.b    (a5),d0
  1974.     bne    P61_zample
  1975.     bra    P61_nocha
  1976.     endc
  1977.  
  1978.     ifne    P61_fsd
  1979. P61_finedwn
  1980.     P61_getnote
  1981.  
  1982.     moveq    #$f,d0
  1983.     and.b    P61_Info(a5),d0
  1984.     add    d0,P61_Period(a5)
  1985.     cmp    #856,P61_Period(a5)
  1986.     ble.b    .jup
  1987.     move    #856,P61_Period(a5)
  1988. .jup    moveq    #$7e,d0
  1989.     and.b    (a5),d0
  1990.     bne    P61_zample
  1991.     bra    P61_nocha
  1992.     endc
  1993.  
  1994.     ifne    P61_sft
  1995. P61_setfinetune
  1996.     moveq    #$f,d0
  1997.     and.b    P61_Info(a5),d0
  1998.     ifeq    opt020
  1999.     add    d0,d0
  2000.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2001.     else
  2002.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2003.     endc
  2004.     bra    P61_fxdone
  2005.  
  2006. P61_mulutab
  2007.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2008.     endc
  2009.  
  2010.     ifne    P61_pl
  2011. P61_patternloop
  2012.     moveq    #$f,d0
  2013.     and.b    P61_Info(a5),d0
  2014.     beq.b    P61_setloop
  2015.  
  2016.     tst.b    P61_plflag(a3)
  2017.     bne.b    P61_noset
  2018.  
  2019.     move    d0,P61_plcount(a3)
  2020.     st.b    P61_plflag(a3)
  2021. P61_noset
  2022.     tst    P61_plcount(a3)
  2023.     bne.b    P61_looppaa
  2024.     clr.b    P61_plflag(a3)
  2025.     bra    P61_fxdone
  2026.     
  2027. P61_looppaa
  2028.     st.b    P61_plflag+1(a3)
  2029.     subq    #1,P61_plcount(a3)
  2030.     bra    P61_fxdone
  2031.  
  2032. P61_setloop
  2033.     tst.b    P61_plflag(a3)
  2034.     bne    P61_fxdone
  2035.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2036.     lea    P61_temp0+P61_TData(pc),a1
  2037.     lea    P61_looppos(pc),a0
  2038.     moveq    #channels-1,d0
  2039. .talt    move.l    (a1)+,(a0)+
  2040.     move.l    (a1)+,(a0)+
  2041.     move.l    (a1),(a0)+
  2042.     subq.l    #8,a1
  2043.     add.l    d6,a1
  2044.     dbf    d0,.talt
  2045.     bra    P61_fxdone
  2046.     endc
  2047.  
  2048.     ifne    P61_fvu
  2049. P61_finevup
  2050.     moveq    #$f,d0
  2051.     and.b    P61_Info(a5),d0
  2052.     add    d0,P61_Volume(a5)
  2053.     moveq    #64,d0
  2054.     cmp    P61_Volume(a5),d0
  2055.     bge    P61_fxdone
  2056.     move    d0,P61_Volume(a5)
  2057.     bra    P61_fxdone
  2058.     endc
  2059.  
  2060.     ifne    P61_fvd
  2061. P61_finevdwn
  2062.     moveq    #$f,d0
  2063.     and.b    P61_Info(a5),d0
  2064.     sub    d0,P61_Volume(a5)
  2065.     bpl    P61_fxdone
  2066.     clr    P61_Volume(a5)
  2067.     bra    P61_fxdone
  2068.     endc
  2069.  
  2070.     ifne    P61_timing
  2071. P61_sete8
  2072.     moveq    #$f,d0
  2073.     and.b    P61_Info(a5),d0
  2074.     move    d0,P61_E8(a3)
  2075.     bra    P61_fxdone
  2076.     endc
  2077.  
  2078.     ifne    P61_rt
  2079. P61_setretrig
  2080.     moveq    #$f,d0
  2081.     and.b    P61_Info(a5),d0
  2082.     move    d0,P61_RetrigCount(a5)
  2083.     bra    P61_fxdone
  2084.     endc
  2085.  
  2086.     ifne    P61_nd
  2087. P61_ndelay
  2088.     moveq    #$7e,d0
  2089.     and.b    (a5),d0
  2090.     beq    P61_skip
  2091.     ifne    P61_vib
  2092.     clr.b    P61_VibPos(a5)
  2093.     endc
  2094.     ifne    P61_tre
  2095.     clr.b    P61_TrePos(a5)
  2096.     endc
  2097.     ifne    P61_ft
  2098.     add    P61_Fine(a5),d0
  2099.     endc
  2100.     move    d0,P61_Note(a5)
  2101.     move    (a2,d0),P61_Period(a5)
  2102.     ifeq    fade
  2103.     move    P61_Volume(a5),8(a4)
  2104.     else
  2105.     move    P61_Volume(a5),P61_Shadow(a5)
  2106.     endc
  2107.     bra    P61_skip
  2108.     endc
  2109.  
  2110.     ifne    P61_pde
  2111. P61_pattdelay
  2112.     moveq    #$f,d0
  2113.     and.b    P61_Info(a5),d0
  2114.     move    d0,P61_pdelay(a3)
  2115.     st    P61_pdflag(a3)
  2116.     bra    P61_fxdone
  2117.     endc
  2118.  
  2119.     ifne    P61_sd
  2120. P61_cspeed
  2121.     moveq    #0,d0
  2122.     move.b    P61_Info(a5),d0
  2123.  
  2124.     ifne    CIA
  2125.     tst    P61_Tempo(a3)
  2126.     beq.b    P61_VBlank
  2127.     cmp.b    #32,d0
  2128.     bhs.b    P61_STempo
  2129.     endc
  2130.  
  2131. P61_VBlank
  2132.     cmp.b    #1,d0
  2133.     beq.b    P61_jkd
  2134.  
  2135.     move.b    d0,P61_speed+1(a3)
  2136.     subq.b    #1,d0
  2137.     move.b    d0,P61_speed2+1(a3)
  2138.     clr    P61_speedis1(a3)
  2139.     bra    P61_fxdone
  2140.  
  2141. P61_jkd    move.b    d0,P61_speed+1(a3)
  2142.     move.b    d0,P61_speed2+1(a3)
  2143.     st    P61_speedis1(a3)
  2144.     bra    P61_fxdone
  2145.  
  2146.  
  2147.     ifne    CIA
  2148. P61_STempo
  2149.     move.l    P61_timer(pc),d1
  2150.     divu    d0,d1
  2151.     move    d1,P61_thi2(a3)
  2152.     sub    #$1f0*2,d1
  2153.     move    d1,P61_thi(a3)
  2154.  
  2155.     ifeq    system
  2156.     move    P61_thi2(a3),d1
  2157.     move.b    d1,$bfd400
  2158.     lsr    #8,d1
  2159.     move.b    d1,$bfd500
  2160.     endc
  2161.  
  2162.     bra    P61_fxdone
  2163.     endc
  2164.     endc
  2165.  
  2166.  
  2167.  
  2168.     ifne    P61_vbvs
  2169. P61_vibochvslide
  2170.     move.b    P61_Info(a5),d0
  2171.     sub.b    d0,P61_Volume+1(a5)
  2172.     bpl.b    P61_test62
  2173.     clr    P61_Volume(a5)
  2174.     ifeq    fade
  2175.     clr    8(a4)
  2176.     else
  2177.     clr    P61_Shadow(a5)
  2178.     endc
  2179.     bra.b    P61_vib2
  2180. P61_test62
  2181.     moveq    #64,d0
  2182.     cmp    P61_Volume(a5),d0
  2183.     bge.b    .ncs2
  2184.     move    d0,P61_Volume(a5)
  2185. .ncs2    ifeq    fade
  2186.     move    P61_Volume(a5),8(a4)
  2187.     else
  2188.     move    P61_Volume(a5),P61_Shadow(a5)
  2189.     endc
  2190.     endc
  2191.  
  2192.     ifne    P61_vib
  2193. P61_vib2
  2194.     move    #$f00,d0
  2195.     move    P61_VibCmd(a5),d1
  2196.     and    d1,d0
  2197.     lsr    #3,d0
  2198.  
  2199.     lsr    #2,d1
  2200.     and    #$1f,d1
  2201.     add    d1,d0
  2202.  
  2203.     move    P61_Period(a5),d1
  2204.     moveq    #0,d2
  2205.     move.b    P61_vibtab(pc,d0),d2
  2206.  
  2207.     tst.b    P61_VibPos(a5)
  2208.     bmi.b    .vibneg
  2209.     add    d2,d1
  2210.     bra.b    P61_vib4
  2211.  
  2212. .vibneg    sub    d2,d1
  2213.  
  2214. P61_vib4
  2215.     move    d1,6(a4)
  2216.     move.b    P61_VibCmd(a5),d0
  2217.     lsr.b    #2,d0
  2218.     and    #$3c,d0
  2219.     add.b    d0,P61_VibPos(a5)
  2220.     bra    P61_contfxdone
  2221.     endc
  2222.  
  2223.     ifne    P61_tre
  2224. P61_tremo
  2225.     move    #$f00,d0
  2226.     move    P61_TreCmd(a5),d1
  2227.     and    d1,d0
  2228.     lsr    #3,d0
  2229.     
  2230.     lsr    #2,d1
  2231.     and    #$1f,d1
  2232.     add    d1,d0
  2233.  
  2234.     move    P61_Volume(a5),d1
  2235.     moveq    #0,d2
  2236.     move.b    P61_vibtab(pc,d0),d2
  2237.  
  2238.     tst.b    P61_TrePos(a5)
  2239.     bmi.b    .treneg
  2240.     add    d2,d1
  2241.     cmp    #64,d1
  2242.     ble.b    P61_tre4
  2243.     moveq    #64,d1
  2244.     bra.b    P61_tre4
  2245.  
  2246. .treneg    sub    d2,d1
  2247.     bpl.b    P61_tre4
  2248.     moveq    #0,d1
  2249. P61_tre4
  2250.     ifeq    fade
  2251.     move    d1,8(a4)
  2252.     else
  2253.     move    d1,P61_Shadow(a5)
  2254.     endc
  2255.  
  2256.     move.b    P61_TreCmd(a5),d0
  2257.     lsr.b    #2,d0
  2258.     and    #$3c,d0
  2259.     add.b    d0,P61_TrePos(a5)
  2260.     bra    P61_contfxdone
  2261.     endc
  2262.  
  2263.     ifne    P61_vib!P61_tre
  2264. P61_vibtab    incbin    player/vibtab
  2265.     endc
  2266.  
  2267.     ifne    P61_il
  2268. P61_funk
  2269.     moveq    #$f,d0
  2270.     and.b    P61_Info(a5),d0
  2271.     move.b    d0,P61_Funkspd(a5)
  2272.     bra    P61_fxdone
  2273.  
  2274. P61_funk2
  2275.     moveq    #0,d0
  2276.     move.b    P61_Funkspd(a5),d0
  2277.     beq.b    P61_funkend
  2278.     move.b    P61_FunkTable(pc,d0),d0
  2279.     add.b    d0,P61_Funkoff(a5)
  2280.     bpl.b    P61_funkend
  2281.     clr.b    P61_Funkoff(a5)
  2282.  
  2283.     move.l    P61_Sample(a5),a1
  2284.     move.l    P61_RepeatOffset(a1),d1
  2285.     move    P61_RepeatLength(a1),d0
  2286.     add.l    d0,d0
  2287.     add.l    d1,d0
  2288.     move.l    P61_Wave(a5),a0
  2289.     addq.l    #1,a0
  2290.     cmp.l    d0,a0
  2291.     blo.b    P61_funkok
  2292.     move.l    d1,a0
  2293. P61_funkok
  2294.     move.l    a0,P61_Wave(a5)
  2295.     not.b    (a0)
  2296. P61_funkend
  2297.     rts
  2298.  
  2299. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2300.     endc
  2301.  
  2302. P61_jtab
  2303.     dr    P61_fxdone
  2304.     dr    P61_fxdone
  2305.     dr    P61_fxdone
  2306.  
  2307.     ifne    P61_tp
  2308.     dr    P61_settoneport
  2309.     else
  2310.     dr    P61_fxdone
  2311.     endc
  2312.  
  2313.     ifne    P61_vib
  2314.     dr    P61_vibrato
  2315.     else
  2316.     dr    P61_fxdone
  2317.     endc
  2318.  
  2319.     ifne    P61_tpvs
  2320.     dr    P61_toponochange
  2321.     else
  2322.     dr    P61_fxdone
  2323.     endc
  2324.  
  2325.     dr    P61_fxdone
  2326.  
  2327.     ifne    P61_tre
  2328.     dr    P61_settremo
  2329.     else
  2330.     dr    P61_fxdone
  2331.     endc
  2332.  
  2333.     dr    P61_fxdone
  2334.  
  2335.     ifne    P61_sof
  2336.     dr    P61_sampleoffse
  2337.     else
  2338.     dr    P61_fxdone
  2339.     endc
  2340.     dr    P61_fxdone
  2341.  
  2342.     ifne    P61_pj
  2343.     dr    P61_posjmp
  2344.     else
  2345.     dr    P61_fxdone
  2346.     endc
  2347.  
  2348.     ifne    P61_vl
  2349.     dr    P61_volum
  2350.     else
  2351.     dr    P61_fxdone
  2352.     endc
  2353.  
  2354.     ifne    P61_pb
  2355.     dr    P61_pattbreak
  2356.     else
  2357.     dr    P61_fxdone
  2358.     endc
  2359.  
  2360.     ifne    P61_ec
  2361.     dr    P61_ecommands
  2362.     else
  2363.     dr    P61_fxdone
  2364.     endc
  2365.     
  2366.     ifne    P61_sd
  2367.     dr    P61_cspeed
  2368.     else
  2369.     dr    P61_fxdone
  2370.     endc
  2371.  
  2372.  
  2373. P61_dmason
  2374.     ifeq    system
  2375.     tst.b    $bfdd00
  2376.     move    #$2000,$dff09c
  2377.     move.b    #$19,$bfdf00
  2378.     move.l    a0,-(sp)
  2379.     move.l    P61_vektori(pc),a0
  2380.     move.l    P61_intaddr(pc),(a0)
  2381.     move.l    (sp)+,a0
  2382.     move    P61_dma(pc),$dff096
  2383.     nop
  2384.     rte
  2385.  
  2386.     else
  2387.  
  2388.     move    P61_dma(pc),$96(a6)
  2389.     lea    P61_server(pc),a3
  2390.     addq    #1,(a3)
  2391.     move.l    P61_craddr(pc),a0
  2392.     move.b    #$19,(a0)
  2393.     bra    P61_ohi
  2394.     endc
  2395.  
  2396.  
  2397. P61_setrepeat
  2398.     ifeq    system
  2399.     tst.b    $bfdd00
  2400.     movem.l    a0/a1,-(sp)
  2401.     lea    $dff0a0,a1
  2402.     move    #$2000,-4(a1)
  2403.     else
  2404.     lea    $a0(a6),a1
  2405.     endc
  2406.  
  2407.     move.l    P61_Sample+P61_temp0(pc),a0
  2408.     addq.l    #6,a0
  2409.     move.l    (a0)+,(a1)+
  2410.     move    (a0),(a1)
  2411.  
  2412.     ifgt    channels-1
  2413.     move.l    P61_Sample+P61_temp1(pc),a0
  2414.     addq.l    #6,a0
  2415.     move.l    (a0)+,12(a1)
  2416.     move    (a0),16(a1)
  2417.     endc
  2418.     
  2419.     ifgt    channels-2
  2420.     move.l    P61_Sample+P61_temp2(pc),a0
  2421.     addq.l    #6,a0
  2422.     move.l    (a0)+,28(a1)
  2423.     move    (a0),32(a1)
  2424.     endc
  2425.  
  2426.     ifgt    channels-3
  2427.     move.l    P61_Sample+P61_temp3(pc),a0
  2428.     addq.l    #6,a0
  2429.     move.l    (a0)+,44(a1)
  2430.     move    (a0),48(a1)
  2431.     endc
  2432.  
  2433.     ifne    system
  2434.     ifne    CIA
  2435.     lea    P61_server(pc),a3
  2436.     clr    (a3)
  2437.     move.l    P61_craddr+4(pc),a0
  2438.     move.b    P61_tlo(pc),(a0)
  2439.     move.b    P61_thi(pc),$100(a0)
  2440.     endc
  2441.     bra    P61_ohi
  2442.     endc
  2443.  
  2444.     ifeq    system
  2445.     ifne    CIA
  2446.     move.l    P61_vektori(pc),a0
  2447.     move.l    P61_tintti(pc),(a0)
  2448.     endc
  2449.     movem.l    (sp)+,a0/a1
  2450.     nop
  2451.     rte
  2452.     endc
  2453.  
  2454. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2455.         dc    1
  2456.  
  2457. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2458.         dc    2
  2459.  
  2460. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2461.         dc    4
  2462.  
  2463. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2464.         dc    8
  2465.  
  2466. P61_cn        dc    0
  2467. P61_dma        dc    $8200
  2468. P61_rowpos    dc    0
  2469. P61_slen    dc    0
  2470. P61_speed    dc    0
  2471. P61_speed2    dc    0
  2472. P61_speedis1    dc    0
  2473. P61_spos    dc.l    0
  2474.  
  2475.     ifeq    system
  2476. P61_vektori    dc.l    0
  2477. P61_oldlev6    dc.l    0
  2478.     endc
  2479.  
  2480. P61_ofilter    dc    0
  2481. P61_timers    dc.l    0
  2482.  
  2483.     ifne    CIA
  2484. P61_tintti    dc.l    0
  2485. P61_thi        dc.b    0
  2486. P61_tlo        dc.b    0
  2487. P61_thi2    dc.b    0
  2488. P61_tlo2    dc.b    0
  2489. P61_timer    dc.l    0
  2490.     endc
  2491.  
  2492.     ifne    P61_pl
  2493. P61_plcount    dc    0
  2494. P61_plflag    dc    0
  2495. P61_plreset    dc    0
  2496. P61_plrowpos    dc    0
  2497. P61_looppos    dcb.b    12*channels
  2498.     endc
  2499.  
  2500.     ifne    P61_pde
  2501. P61_pdelay    dc    0
  2502. P61_pdflag    dc    0
  2503.     endc
  2504.  
  2505. P61_samples    dcb.b    16*31
  2506. P61_emptysample    dcb.b    16
  2507. P61_positionbase dc.l    0
  2508. P61_possibase    dc.l    0
  2509. P61_patternbase    dc.l    0
  2510. P61_intaddr    dc.l    0
  2511.  
  2512. * modified for use with ROS.lib
  2513.  
  2514.     ifne    system
  2515. P61_server    dc    0
  2516. ;P61_miscbase    dc.l    0
  2517. ;P61_audioopen    dc.b    0
  2518. ;P61_sigbit    dc.b    -1
  2519. ;P61_ciares    dc.l    0
  2520. P61_craddr    dc.l    0,0,0
  2521. ;P61_dat        dc    $f00
  2522. ;P61_timerinterrupt dc    0,0,0,0,127
  2523. ;P61_timerdata    dc.l    0,0,0
  2524. ;P61_timeron    dc    0
  2525. ;P61_allocport    dc.l    0,0
  2526. ;        dc.b    4,0
  2527. ;        dc.l    0
  2528. ;        dc.b    0,0
  2529. ;        dc.l    0
  2530. ;P61_reqlist    dc.l    0,0,0
  2531. ;        dc.b    5,0
  2532. ;P61_allocreq    dc.l    0,0
  2533. ;        dc    127
  2534. ;        dc.l    0
  2535. ;P61_portti    dc.l    0
  2536. ;        dc    68
  2537. ;        dc.l    0,0,0
  2538. ;        dc    0
  2539. ;P61_reqdata    dc.l    0
  2540. ;        dc.l    1,0,0,0,0,0,0
  2541. ;        dc    0
  2542. ;P61_audiodev    dc.b    'audio.device',0
  2543. ;
  2544. ;P61_cianame    dc.b    'ciab.resource',0
  2545. ;P61_timeropen    dc.b    0
  2546. ;P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2547.     endc
  2548. P61_etu
  2549.  
  2550.     endb    a3
  2551.  
  2552.  
  2553.